package org.testis.testdriver.client;

import org.testis.testdriver.exceptions.TestAbortException;
import org.testis.testdriver.validation.CriticalPostCaseException;
import org.testis.client.TestisApplicationContext;

import org.testis.testdriver.*;
import java.util.logging.Level;
import java.util.logging.Logger;


public class Client
{

    public static void main(String[] args)
    {
        try {
            TestisApplicationContext.initializeForClient();


            TestPlanParser gh = new TestPlanParser();
            TestPart sample = gh.construct("AirtiesFirst");
            ExecutionInterface executer = new Runner(sample);            
            ExecutionGuidProvider.createInstance().generateNewExecId();
            executer.execute();


        } catch (CriticalPostCaseException ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE,
                                                         null,
                                                         ex);
        } catch (InterruptedException ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE,
                                                         null,
                                                         ex);
        } catch (TestAbortException ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE,
                                                         null,
                                                         ex);
        }
        catch (Exception ex) {
            Logger.getLogger(Client.class.getName()).log(Level.SEVERE,
                                                         null,
                                                         ex);
        }
        finally
        {
            TestisApplicationContext.close();

            System.exit(0);

        }




    }
}

